package com.webdrider.util;

import com.common.model.util.UserType;
import com.webdrider.security.exceptions.ConverterException;

public class Converter {

	private Converter() {}
	
	public static Long convertToLong(String value) throws ConverterException {
		try {
			return new Long(value);
		} catch (Exception e) {
			throw new ConverterException(ConverterException.CONVERTER_EXCEPTION);
		}
	}
	
	public static UserType convertToUserType(String value) throws ConverterException {
		try {
			return UserType.valueOf(value);
		} catch (IllegalArgumentException argumentException) {
			throw new ConverterException(ConverterException.CONVERTER_EXCEPTION);
		}
	}
}
